/* eslint-disable import/no-named-as-default */
// eslint-disable-next-line import/no-named-as-default-member
import $api from './index';

interface conpanyData {
  name: string,
  isVue: number,
  isReact: number,
  areaid: string,
  desc?: string,
  skill?: string
}
export default null;
// 添加公司
export const addConpany = async (data: conpanyData) => {
  const res = await $api.post('/conpany', data);
  return res;
};
// 查询
export const getConpany = async ({
  $limit = 5,
  $skip = 0,
  isVue = false,
  isReact = false,
}) => {
  const hasVue = isVue ? '&isVue=1' : '';
  const hasReact = isReact ? '&isReact=1' : '';
  const res = await $api.get(`/conpany?$limit=${$limit}&$skip=${$skip}${hasVue}${hasReact}`);
  return res;
};

// 删除
export const delConpany = async (id:string|number) => {
  const res = await $api.delete(`/conpany/${id}`);
  return res;
};

// 编辑
export const editConpany = async (data: conpanyData, id: string) => {
  const res = await $api.put(`/conpany/${id}`, data);
  return res;
};
